﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace IntelliTouchMix
{
    public class AnimationControl : DevComponents.DotNetBar.Controls.ReflectionImage // Control
    {
        static float minDistAllowed = 1.0f;
        Point2f mfSize;
        Point2f mfPos;
        Point2f mDeltaSize;
        Point2f mDeltaPos;

        public void setData(Point2f mfSize1, Point2f mfPos1, Point2f mDeltaSize1, Point2f mDeltaPos1)
        {
            mDeltaPos = mDeltaPos1;
            mDeltaSize = mDeltaSize1;
            mfPos = mfPos1;
            mfSize = mfSize1;
        }
        public void setDataLeftAnim()
        {
            mDeltaPos = new Point2f(2, 0);
            mDeltaSize = new Point2f(-1, -1);
            mfPos = new Point2f( Location.X + 300,  Location.Y);
            mfSize =  new Point2f(Size.Width,Size.Height);
        }
        public bool updateAnimation()
        {
            if (mfPos.dist2(Location) > minDistAllowed)
            {
                Location = Point2f.add(mDeltaPos, Location);                
                if (mfSize.dist2(Size) > minDistAllowed)
                {
                    Size = Point2f.add(mDeltaSize, Size);
                }

            }
            else if (mfSize.dist2(Size) > minDistAllowed)
            {
                Size = Point2f.add(mDeltaSize, Size);                
            }else
                return false;
            return true;
        }
    }
}
